package de.fmaul.dicheck.assertions;

import de.fmaul.dicheck.model.DataRow;
import de.fmaul.dicheck.model.DataSet;
import de.fmaul.dicheck.model.DataTableMetaData;
import de.fmaul.dicheck.model.TestCase;
import de.fmaul.dicheck.model.TestOutcome;
import de.fmaul.dicheck.runner.TestResult;

public abstract class AbstractAssertion implements Assertion {

    // Set the default error message
    private String message = "Query returned results!";

    public void checkDataSet(TestCase testCase, TestResult testResult,
            DataSet dataset) {

    }

    public void checkMetaData(TestCase testCase, TestResult testResul,
            DataTableMetaData metaData) {

    }

    public void checkRow(TestCase testCase, TestResult testResult, DataRow row) {

    }

    public void postTest(TestCase testCase, TestResult testResult) {

    }

    public void preTest(TestCase testCase, TestResult testResult) {

    }

    public String getMessage() {
        return message;
    }

    protected void setMessage(final String message) {
        this.message = message;
    }
    

    protected final void fail(TestResult testResult) {
        testResult.addError(getMessage());
        testResult.setOutcome(TestOutcome.FAILED);
    }
}
